package no.sachmuld.methodcombination.examples.reflection.clossimplestyle.resource;

import no.sachmuld.methodcombination.api.BehaviourChain;
import no.sachmuld.methodcombination.api.reflection.All;

/**
 *
 */
public abstract class Resource  implements AutoCloseable {

    private BehaviourChain<ResourceBehaviour> chain = new BehaviourChain<>();

    final public void close() {
        new All().build(ResourceBehaviour.class, Resource.class, "close").execute(this, chain);
    }

    final protected Resource with(ResourceBehaviour... resourceBehaviours) {
        chain.addAll(resourceBehaviours);
        return this;
    }



}
